<%= form_for(@transaction) do |f| %>
  <% if @transaction.errors.any? %>
    <div id="error_explanation">
      <h2><%= pluralize(@transaction.errors.count, t('common.error')) %> <%=t('message.error.transaction.header')%></h2>
      <ul>
      <% @transaction.errors.full_messages.each do |msg| %>
        <li><%= msg %></li>
      <% end %>
      </ul>
    </div>
  <% end %>
  <%= f.hidden_field :transaction_type%>
  <div class="margin-top10">
    <%= label_tag :amount, t('field.transaction.summa'), :class => "form-label" %><br />
    <%= f.number_field :amount, :id => "amount", :class => "input-field amount-input-field"%>
  </div>
  <div class="margin-top10">
    <%= label_tag :date, t('field.common.date'), :class => "form-label"%><br/>
    <%= f.text_field :date, :class => "input-field amount-input-field",  :id => "date", :readOnly => "readonly"%>
  </div>

<%if  @transaction.transaction_type == Transaction::TRANSACTION_TO_ACCOUNT.to_s(10) ||  @transaction.transaction_type == Transaction::TRANSACTION_TO_ACCOUNT%>
    <%=render :partial => 'transactions/form_to_account'%>
<%elsif  @transaction.transaction_type == Transaction::TRANSACTION_FROM_ACCOUNT_TO_ACCOUNT.to_s(10) ||  @transaction.transaction_type == Transaction::TRANSACTION_FROM_ACCOUNT_TO_ACCOUNT%>
    <%=render :partial => 'transactions/form_from_account_to_account'%>
<%elsif  @transaction.transaction_type == Transaction::TRANSACTION_FROM_ACCOUNT_TO_CASH.to_s(10) ||  @transaction.transaction_type == Transaction::TRANSACTION_FROM_ACCOUNT_TO_CASH%>
    <%=render :partial => 'transactions/form_from_account_to_cash'%>
<%elsif  @transaction.transaction_type == Transaction::TRANSACTION_FROM_ACCOUNT_TO_CATEGORY.to_s(10) ||  @transaction.transaction_type == Transaction::TRANSACTION_FROM_ACCOUNT_TO_CATEGORY%>
    <%=render :partial => 'transactions/form_from_account_to_category'%>
<%elsif  @transaction.transaction_type == Transaction::TRANSACTION_TO_CASH.to_s(10) ||  @transaction.transaction_type == Transaction::TRANSACTION_TO_CASH%>
    <%=render :partial => 'transactions/form_to_cash'%>
<%elsif  @transaction.transaction_type == Transaction::TRANSACTION_FROM_CASH_TO_ACCOUNT.to_s(10) ||  @transaction.transaction_type == Transaction::TRANSACTION_FROM_CASH_TO_ACCOUNT%>
    <%=render :partial => 'transactions/form_from_cash_to_account'%>
<%elsif  @transaction.transaction_type == Transaction::TRANSACTION_FROM_CASH_TO_CASH.to_s(10) ||  @transaction.transaction_type == Transaction::TRANSACTION_FROM_CASH_TO_CASH%>
    <%=render :partial => 'transactions/form_from_cash_to_cash'%>
<%elsif  @transaction.transaction_type == Transaction::TRANSACTION_FROM_CASH_TO_CATEGORY.to_s(10) ||  @transaction.transaction_type == Transaction::TRANSACTION_FROM_CASH_TO_CATEGORY%>
    <%=render :partial => 'transactions/form_from_cash_to_category'%>
<%end%>
  <div class="margin-top10">
    <%= label_tag :comment, t('field.transaction.comment'), :class => "form-label" %><br />
    <%= f.text_area :comment, :size => "60x6", :id => "comment", :class => "text-area"%>
  </div>
  <div class="emptyh20">&nbsp;</div>
  <div class="actions form-buttons">
     <%= f.submit "", :class=>"save-button", :title=>t('button.save')%>
  </div>
<% end %>

<script type="text/javascript">
    jQuery(document).ready(function(){
        transactionsJS.formInit();
    });
</script>